""" 方法1 """
import re
class Solution(object):
    def replaceSpaces(self, s):
        """
        :type s: str
        :rtype: str
        """
        return re.sub(r' ', "%20", s)

""" 方法2 """
class Solution(object):
    def replaceSpaces(self, s):
        """
        :type s: str
        :rtype: str
        """
        t = ''
        for x in s:
            if x != ' ':
                t += x
            else:
                t += '%20'
        return t